/*
 * @lc app=leetcode.cn id=520 lang=csharp
 *
 * [520] 检测大写字母
 */

// @lc code=start
public class Solution {
    public bool DetectCapitalUse(string word) {
        int n = word.Length;
        if (n == 1) return true;
        bool first = char.IsUpper(word[0]);
        bool second = char.IsUpper(word[1]);
        if (!first && second) return false;
        for (int i = 2; i < n; i++)
        {
            if (char.IsUpper(word[i]) != second)
            {
                return false;
            }
        }
        return true;
    }
}
// @lc code=end

